//
//  SS_ChannelCell.swift
//  SSNews
//
//  Created by 叶竞泽 on 2017/5/1.
//  Copyright © 2017年 叶竞泽. All rights reserved.
//

import UIKit
import SDWebImage

class SS_ChannelCell: UITableViewCell {
    
    var data: NewsData? {
        didSet {
            if data?.title != nil {
                titleLabel.text = data?.title
                titleLabel.isHidden = false
            }
            
            if let urlString1 = data?.thumbnail_pic_s {
                if let url = URL(string: urlString1) {
                    image1.setImageWith(url)
                }
            }
            if let urlString2 = data?.thumbnail_pic_s02 {
                if let url = URL(string: urlString2) {
                    image2.setImageWith(url)
                }
            }
            if data?.author_name != nil {
                author_name.text = data?.author_name
                author_name.isHidden = false
            }
            if data?.date != nil {
                timeLabel.text = data?.date
                timeLabel.isHidden = false
            }
        }
    }
    
    
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var image1: UIImageView!
    @IBOutlet weak var image2: UIImageView!
    @IBOutlet weak var author_name: UILabel!
    @IBOutlet weak var timeLabel: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        
        selectionStyle = .none
        titleLabel.isHidden = true
        author_name.isHidden = true
        timeLabel.isHidden = true
    }
}
